home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 October
/
1986-10.d64
/
math attack
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
123 lines
10 for i=54272to54296:pokei,0:next
20 poke51,127:poke52,62:poke55,127:poke56,62:clr:goto40
30 print"";:forc=1to21:printc$:next:print"":return
40 c$=" ":printchr$(142);chr$(8)
50 print"[147]";:poke53280,0:poke53281,0:v=53248:poke54281,75
60 poke54296,15:f=54273:ad=f+4:sr=f+5:w=f+3:f2=f+7:w2=w+7:pokew+8,0:pokew+9,240
70 d$="":tb$=d$+""
80 print" [175][185] [162] [164] [185] [162] [164][175][185][162] [162][185][175][164] [185][164][175] [175][164][162] [164]"
90 print" [163] [184][183] [184] [183][184] [163] [184][163] [163] [184][183][163] [184] [183][184] "
100 print" ":bc=peek(v+31)
110 print"[156]type: +[146] (addition)"
120 print"-[146] (subtraction)"
130 print"x[146] (multiplication)"
140 gett$:ift$<>"+"andt$<>"-"andt$<>"x"then140
150 gosub30:dimn(10,7):poke56334,peek(56334)and254:poke1,peek(1)and251
160 cs=53632:forx=0to9:fory=0to7:n(x,y)=peek(cs):cs=cs+1:nexty,x
170 sn=-53440*(t$="x")-53592*(t$="+")-53608*(t$="-")
180 fory=0to7:n(10,y)=peek(sn):sn=sn+1:next
190 poke1,peek(1)or4:poke56334,peek(56334)or1
200 print"[158]level: 123"
210 print"(limits) 9 99 99"
220 print" "t$" 9 "t$" 9 "t$"99"
230 print" [163][163][163] [163][163][163] [163][163][163]"
240 getl$:ifl$<>"1"andl$<>"2"andl$<>"3"then240
250 l=val(l$):l1=-9*(l=1)-99*(l=2)-99*(l=3):l2=-9*(l=1)-9*(l=2)-99*(l=3)
260 gosub30:pokev,100:pokev+2,175:pokev+4,250:pokev+1,0:pokev+3,0:pokev+5,0
270 forx=16000to16191:readd:pokex,d:next:pokev+39,5:pokev+40,3:pokev+41,8
280 data0,0,0,0,0,0,0,0
290 data0,0,0,0,0,0,0,0
300 data0,0,0,16,0,0,74,0
310 data2,82,64,2,74,64,2,82
320 data64,17,36,136,9,36,144,41
330 data36,148,36,145,36,18,137,72
340 data73,82,146,36,137,36,18,82
350 data72,170,137,85,0,84,0,0
360 data0,170,0,5,85,64,21,85
370 data80,42,170,168,85,85,84,85
380 data85,84,85,85,84,42,170,168
390 data21,85,80,5,85,64,0,170
400 data0,0,0,0,0,0,0,0
410 data0,0,0,0,0,0,0,0
420 data0,0,0,0,0,0,0,0
430 data0,0,0,0,0,0,0,0
440 data96,0,1,96,64,2,16,35
450 data4,15,144,24,10,126,48,4
460 data173,96,4,30,18,70,35,192
470 data53,65,72,36,129,40,20,129
480 data72,28,129,192,36,2,66,124
490 data102,98,162,120,80,53,144,152
500 data1,73,48,2,6,80,4,2
510 data200,8,1,4,144,0,0,0
520 forx=16192to16384:pokex,0:next
530 poke2040,253:poke2041,254:poke2042,255
540 forsn=0to2:gosub1080:next:pokev+21,7:pokev+31,0:gosub30:poke198,0
550 y(0)=0:y(1)=30:y(2)=10:printd$"answers:[175]";tab(19);"bombs you missed: 0";
560 forx=0to2:y(x)=y(x)+1:next
570 pokev+1,y(0):pokev+3,y(1):pokev+5,y(2):bc=peek(v+31)
580 pokew2,17:pokef2,y(0):pokef2,y(1):pokef2,y(2):pokew2,0
590 ford=0to(l-1)*100:next
600 getn$:if(n$=>"0"andn$<="9")orn$="-"orn$=chr$(20)orn$=chr$(13)then700
610 bc=peek(v+31)and7:ifbc=0then560
620 if(bcand1)=1thensn=0:gosub660
630 if(bcand2)=2thensn=1:gosub660
640 if(bcand4)=4thensn=2:gosub660
650 goto560
660 bh=bh+1:pokev+1+sn*2,221:poke2040+sn,250:pokew,0:pokead,12:pokef,1
670 pokew,129:ford=1to100:next:pokew,0:pokew,129:poke2040+sn,251:ford=1to100
680 next:gosub1080:printtb$;tab(36)bh;:y(sn)=30:ifbh>2then890
690 poke2040+sn,253+sn:return
700 ifn$=chr$(20)andtb>0thentb=tb-1:print" [157][157][175][157]";:an$=left$(an$,len(an$)-1)
710 ifn$=chr$(20)then610
720 ifn$<>"-"then750
730 iftb=0thentb=1:an$="-":printleft$(tb$,33)"-[175][157]";
740 goto610
750 ifn$=chr$(13)then780
760 iftb<4thenprintleft$(tb$,33+tb);n$;"[175][157]";:tb=tb+1:an$=an$+n$
770 goto610
780 an=val(an$):printd$;"[175] ";:an$="":tb=0
790 cf=0:forxx=0to2:ifa(xx)=anandy(xx)<221thengosub860
800 next:iftc>=20then1000
810 ifcf>0then850
820 wt=wt+1:forx=0to2:y(x)=y(x)+(3-l)*10:ify(x)>200theny(x)=200
830 next:l=l-1:pokew,0:pokead,0:pokesr,240
840 pokew,17:ford=255to100step-2:pokef,d:next:pokew,0:pokesr,0
850 goto610
860 tc=tc+1:at=at+1:poke2040+xx,252:sn=xx:pokew,0:pokead,144:pokef,250
870 pokew,129:ford=1to100:next:poke2040+xx,253+xx:gosub1080:y(xx)=30:cf=1
880 bc=peek(v+31):return
890 pokev+1,0:pokev+3,0:pokev+5,0
900 print"[147]math problems invade the city":goto930
910 print"[147]you've beaten the math problems"
920 print" at their own game"
930 print"[153]game results:":print"right answers:"at
940 print"[156]wrong answers:"wt
950 print"[129]bombs reaching the city:"bh
960 print"[154]do you want another chance? (y/n)?"
970 getc$:ifc$<>"y"andc$<>"n"then970
980 ifc$="y"thenrun
990 print"[147][154]";:poke53280,14:poke53281,6:pokev+21,0:end
1000 forx=0to2:y(x)=0:pokev+1+2*x,0:next:ifl1+l2>1000then910
1010 print"[156]"tc"correct answers":tc=0
1020 print"[150]you may go on . . . ."
1030 print" to the next level"
1040 l1$=str$(l1):l2$=str$(l2):ifl2<l1thenl2$=l2$+"9":goto1060
1050 l1$=l1$+"9"
1060 l1=val(l1$):l2=val(l2$):print"[158]your new limits are: "l1"and"l2
1070 goto530
1080 u$=str$(int(rnd(0)*l1)):b$=str$(int(rnd(0)*l2)):b$=right$(b$,2)
1090 ift$="x"thena(sn)=val(u$)*val(b$)
1100 ift$="+"thena(sn)=val(u$)+val(b$)
1110 ift$="-"thena(sn)=val(u$)-val(b$)
1120 b$=t$+b$:u$=right$(u$,3):sy=sn*2+1+v:iflen(u$)=2thenu$=" "+u$
1130 ss=(sn+253)*64:pokew2,0:pokew2,65:fory=0to2:c1$=mid$(u$,y+1,1)
1140 forx=0to7:pokess+x*3+y,n(val(c1$),x):ifc1$=" "thenpokess+x*3+y,0
1150 pokesy,abs(peek(sy)-3):pokef2,100-10*x:nextx,y
1160 fory=0to2:c1$=mid$(b$,y+1,1):forx=8to15
1170 pokess+x*3+y,n(val(c1$),x-8):pokef2,10*x:pokesy,abs(peek(sy)-3)
1180 ifc1$=" "thenpokess+x*3+y,0
1190 ifc1$=t$thenpokess+x*3+y,n(10,x-8)
1200 nextx,y:pokew2,0
1210 pokess+48,255:pokess+49,255:pokess+50,255
1220 forx=ss+51toss+62:pokex,0:next:return